package o;

import android.os.Build.VERSION;
import android.text.PrecomputedText.Params;
import android.text.Spannable;
import android.text.TextDirectionHeuristic;
import android.text.TextDirectionHeuristics;
import android.text.TextPaint;
import android.text.TextUtils;
import android.text.style.MetricAffectingSpan;
import androidx.annotation.GuardedBy;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.annotation.RestrictTo;
import java.util.concurrent.Executor;

public class gv implements Spannable {
    private static final Object ˎ = new Object();
    @GuardedBy("sLock")
    @NonNull
    private static Executor ॱ = null;
    @NonNull
    private final a ˊ;
    @NonNull
    private final Spannable ˏ;

    public static final class a {
        @NonNull
        private final TextPaint ˊ;
        final Params ˋ = null;
        private final int ˎ;
        @Nullable
        private final TextDirectionHeuristic ˏ;
        private final int ॱ;

        public static class d {
            private TextDirectionHeuristic ˊ;
            private int ˋ;
            @NonNull
            private final TextPaint ˎ;
            private int ˏ;

            public d(@NonNull TextPaint textPaint) {
                this.ˎ = textPaint;
                if (VERSION.SDK_INT >= 23) {
                    this.ˏ = 1;
                    this.ˋ = 1;
                } else {
                    this.ˋ = 0;
                    this.ˏ = 0;
                }
                if (VERSION.SDK_INT >= 18) {
                    this.ˊ = TextDirectionHeuristics.FIRSTSTRONG_LTR;
                } else {
                    this.ˊ = null;
                }
            }

            @RequiresApi(23)
            public d ॱ(int i) {
                this.ˏ = i;
                return this;
            }

            @RequiresApi(23)
            public d ˋ(int i) {
                this.ˋ = i;
                return this;
            }

            @RequiresApi(18)
            public d ˊ(@NonNull TextDirectionHeuristic textDirectionHeuristic) {
                this.ˊ = textDirectionHeuristic;
                return this;
            }

            @NonNull
            public a ˏ() {
                return new a(this.ˎ, this.ˊ, this.ˏ, this.ˋ);
            }
        }

        a(@NonNull TextPaint textPaint, @NonNull TextDirectionHeuristic textDirectionHeuristic, int i, int i2) {
            this.ˊ = textPaint;
            this.ˏ = textDirectionHeuristic;
            this.ॱ = i;
            this.ˎ = i2;
        }

        @RequiresApi(28)
        public a(@NonNull Params params) {
            this.ˊ = params.getTextPaint();
            this.ˏ = params.getTextDirection();
            this.ॱ = params.getBreakStrategy();
            this.ˎ = params.getHyphenationFrequency();
        }

        @NonNull
        public TextPaint ˎ() {
            return this.ˊ;
        }

        @RequiresApi(18)
        @Nullable
        public TextDirectionHeuristic ˏ() {
            return this.ˏ;
        }

        @RequiresApi(23)
        public int ॱ() {
            return this.ॱ;
        }

        @RequiresApi(23)
        public int ˊ() {
            return this.ˎ;
        }

        @RestrictTo({androidx.annotation.RestrictTo.d.ॱ})
        public boolean ॱ(@NonNull a aVar) {
            if (this.ˋ != null) {
                return this.ˋ.equals(aVar.ˋ);
            }
            if ((VERSION.SDK_INT >= 23 && (this.ॱ != aVar.ॱ() || this.ˎ != aVar.ˊ())) || this.ˊ.getTextSize() != aVar.ˎ().getTextSize() || this.ˊ.getTextScaleX() != aVar.ˎ().getTextScaleX() || this.ˊ.getTextSkewX() != aVar.ˎ().getTextSkewX()) {
                return false;
            }
            if ((VERSION.SDK_INT >= 21 && (this.ˊ.getLetterSpacing() != aVar.ˎ().getLetterSpacing() || !TextUtils.equals(this.ˊ.getFontFeatureSettings(), aVar.ˎ().getFontFeatureSettings()))) || this.ˊ.getFlags() != aVar.ˎ().getFlags()) {
                return false;
            }
            if (VERSION.SDK_INT >= 24) {
                if (!this.ˊ.getTextLocales().equals(aVar.ˎ().getTextLocales())) {
                    return false;
                }
            } else if (VERSION.SDK_INT >= 17 && !this.ˊ.getTextLocale().equals(aVar.ˎ().getTextLocale())) {
                return false;
            }
            if (this.ˊ.getTypeface() == null) {
                if (aVar.ˎ().getTypeface() != null) {
                    return false;
                }
            } else if (!this.ˊ.getTypeface().equals(aVar.ˎ().getTypeface())) {
                return false;
            }
            return true;
        }

        public boolean equals(@Nullable Object obj) {
            if (obj == this) {
                return true;
            }
            if (!(obj instanceof a)) {
                return false;
            }
            a aVar = (a) obj;
            if (!ॱ(aVar)) {
                return false;
            }
            if (VERSION.SDK_INT < 18 || this.ˏ == aVar.ˏ()) {
                return true;
            }
            return false;
        }

        public int hashCode() {
            if (VERSION.SDK_INT >= 24) {
                return gz.ˏ(Float.valueOf(this.ˊ.getTextSize()), Float.valueOf(this.ˊ.getTextScaleX()), Float.valueOf(this.ˊ.getTextSkewX()), Float.valueOf(this.ˊ.getLetterSpacing()), Integer.valueOf(this.ˊ.getFlags()), this.ˊ.getTextLocales(), this.ˊ.getTypeface(), Boolean.valueOf(this.ˊ.isElegantTextHeight()), this.ˏ, Integer.valueOf(this.ॱ), Integer.valueOf(this.ˎ));
            } else if (VERSION.SDK_INT >= 21) {
                return gz.ˏ(Float.valueOf(this.ˊ.getTextSize()), Float.valueOf(this.ˊ.getTextScaleX()), Float.valueOf(this.ˊ.getTextSkewX()), Float.valueOf(this.ˊ.getLetterSpacing()), Integer.valueOf(this.ˊ.getFlags()), this.ˊ.getTextLocale(), this.ˊ.getTypeface(), Boolean.valueOf(this.ˊ.isElegantTextHeight()), this.ˏ, Integer.valueOf(this.ॱ), Integer.valueOf(this.ˎ));
            } else if (VERSION.SDK_INT >= 18) {
                return gz.ˏ(Float.valueOf(this.ˊ.getTextSize()), Float.valueOf(this.ˊ.getTextScaleX()), Float.valueOf(this.ˊ.getTextSkewX()), Integer.valueOf(this.ˊ.getFlags()), this.ˊ.getTextLocale(), this.ˊ.getTypeface(), this.ˏ, Integer.valueOf(this.ॱ), Integer.valueOf(this.ˎ));
            } else if (VERSION.SDK_INT >= 17) {
                return gz.ˏ(Float.valueOf(this.ˊ.getTextSize()), Float.valueOf(this.ˊ.getTextScaleX()), Float.valueOf(this.ˊ.getTextSkewX()), Integer.valueOf(this.ˊ.getFlags()), this.ˊ.getTextLocale(), this.ˊ.getTypeface(), this.ˏ, Integer.valueOf(this.ॱ), Integer.valueOf(this.ˎ));
            } else {
                return gz.ˏ(Float.valueOf(this.ˊ.getTextSize()), Float.valueOf(this.ˊ.getTextScaleX()), Float.valueOf(this.ˊ.getTextSkewX()), Integer.valueOf(this.ˊ.getFlags()), this.ˊ.getTypeface(), this.ˏ, Integer.valueOf(this.ॱ), Integer.valueOf(this.ˎ));
            }
        }

        public String toString() {
            StringBuilder stringBuilder = new StringBuilder("{");
            stringBuilder.append("textSize=" + this.ˊ.getTextSize());
            stringBuilder.append(", textScaleX=" + this.ˊ.getTextScaleX());
            stringBuilder.append(", textSkewX=" + this.ˊ.getTextSkewX());
            if (VERSION.SDK_INT >= 21) {
                stringBuilder.append(", letterSpacing=" + this.ˊ.getLetterSpacing());
                stringBuilder.append(", elegantTextHeight=" + this.ˊ.isElegantTextHeight());
            }
            if (VERSION.SDK_INT >= 24) {
                stringBuilder.append(", textLocale=" + this.ˊ.getTextLocales());
            } else if (VERSION.SDK_INT >= 17) {
                stringBuilder.append(", textLocale=" + this.ˊ.getTextLocale());
            }
            stringBuilder.append(", typeface=" + this.ˊ.getTypeface());
            if (VERSION.SDK_INT >= 26) {
                stringBuilder.append(", variationSettings=" + this.ˊ.getFontVariationSettings());
            }
            stringBuilder.append(", textDir=" + this.ˏ);
            stringBuilder.append(", breakStrategy=" + this.ॱ);
            stringBuilder.append(", hyphenationFrequency=" + this.ˎ);
            stringBuilder.append("}");
            return stringBuilder.toString();
        }
    }

    @NonNull
    public a ˊ() {
        return this.ˊ;
    }

    public void setSpan(Object obj, int i, int i2, int i3) {
        if (obj instanceof MetricAffectingSpan) {
            throw new IllegalArgumentException("MetricAffectingSpan can not be set to PrecomputedText.");
        }
        this.ˏ.setSpan(obj, i, i2, i3);
    }

    public void removeSpan(Object obj) {
        if (obj instanceof MetricAffectingSpan) {
            throw new IllegalArgumentException("MetricAffectingSpan can not be removed from PrecomputedText.");
        }
        this.ˏ.removeSpan(obj);
    }

    public <T> T[] getSpans(int i, int i2, Class<T> cls) {
        return this.ˏ.getSpans(i, i2, cls);
    }

    public int getSpanStart(Object obj) {
        return this.ˏ.getSpanStart(obj);
    }

    public int getSpanEnd(Object obj) {
        return this.ˏ.getSpanEnd(obj);
    }

    public int getSpanFlags(Object obj) {
        return this.ˏ.getSpanFlags(obj);
    }

    public int nextSpanTransition(int i, int i2, Class cls) {
        return this.ˏ.nextSpanTransition(i, i2, cls);
    }

    public int length() {
        return this.ˏ.length();
    }

    public char charAt(int i) {
        return this.ˏ.charAt(i);
    }

    public CharSequence subSequence(int i, int i2) {
        return this.ˏ.subSequence(i, i2);
    }

    public String toString() {
        return this.ˏ.toString();
    }
}
